<html>
   <head>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body onload="">
<h2 class="comptitle">NED File <i>modules/nic/Nic802154_TI_CC2420.ned</i></h2>
<table class="typetable">
   <tr>
      <th>Name</th>
      <th>Description</th>
   </tr>
<tr>
   <td>
      <a href="org.mixim.modules.nic.Nic802154_TI_CC2420.html">Nic802154_TI_CC2420</a>
      <i> (compound&nbsp;module)</i>
   </td>
   <td>

<p>This NIC implements a Texas Instruments CC 2420 802.15.4 network interface card
using the CSMA protocol as specified in IEEE 802.15.4-2006.</p>
   </td>
</tr>
</table>
<h3 class="subtitle">Source code:</h3>
<pre class="src"><span style="color: #808080; font-style: italic; ">//***************************************************************************
// * file:        Nic802154_TI_CC2420.ned
// *
// * author:      Jerome Rousselot, Marc Loebbers
// *
// * copyright:   (C) 2008-2010 CSEM SA, Neuchatel, Switzerland.
// *		  	  (C) 2004 Telecommunication Networks Group (TKN) at
// *              Technische Universitaet Berlin, Germany.
// *
// *              This program is free software; you can redistribute it
// *              and/or modify it under the terms of the GNU General Public
// *              License as published by the Free Software Foundation; either
// *              version 2 of the License, or (at your option) any later
// *              version.
// *              For further information see file COPYING
// *              in the top level directory
// *
// * Funding: This work was partially financed by the European Commission under the  
// * Framework 6 IST Project &quot;Wirelessly Accessible Sensor Populations&quot;  
// * (WASP) under contract IST-034963.
// **************************************************************************/
</span><span style="color: #000000; ">
</span><span style="color: #800000; font-weight: bold; ">package</span><span style="color: #000000; "> </span><span style="color: #000000; ">org</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mixim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">modules</span><span style="color: #000000; ">.</span><span style="color: #000000; ">nic</span><span style="color: #000000; ">;

</span><span style="color: #800000; font-weight: bold; ">import</span><span style="color: #000000; "> </span><span style="color: #000000; ">org</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mixim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">modules</span><span style="color: #000000; ">.</span><span style="color: #000000; ">phy</span><span style="color: #000000; ">.</span><span style="color: #000000; ">PhyLayerBattery</span><span style="color: #000000; ">;
</span><span style="color: #800000; font-weight: bold; ">import</span><span style="color: #000000; "> </span><span style="color: #000000; ">org</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mixim</span><span style="color: #000000; ">.</span><span style="color: #000000; ">modules</span><span style="color: #000000; ">.</span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">CSMA802154</span><span style="color: #000000; ">;


</span><span style="color: #808080; font-style: italic; ">//
// This NIC implements a Texas Instruments CC 2420 802.15.4 network interface card
// using the CSMA protocol as specified in IEEE 802.15.4-2006.
//
//Note: To be able to use this Nic in your simulation you have to copy the file 
//&quot;Nic802154_TI_CC2420_Decider.xml&quot; from &quot;modules/nic/&quot; to your simulation directory.
// </span><span style="color: #000080; ">@author</span><span style="color: #808080; font-style: italic; "> Jerome Rousselot
//
</span><span style="color: #800000; font-weight: bold; ">module</span><span style="color: #000000; "> </span><span style="color: #000000; ">Nic802154_TI_CC2420</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">like</span><span style="color: #000000; "> </span><span style="color: #000000; ">INic</span><span style="color: #000000; ">
{
    </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
        </span><span style="color: #000080; font-weight: bold; ">string</span><span style="color: #000000; "> </span><span style="color: #000000; ">connectionManagerName</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;&quot;</span><span style="color: #000000; ">);   </span><span style="color: #808080; font-style: italic; ">//name of the ConnectionManager module
</span><span style="color: #000000; ">        </span><span style="color: #808080; font-style: italic; ">// power consumption from boards (at 3.3V)
</span><span style="color: #000000; ">	    </span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">sleepCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">000021</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// 0.021 &micro;A
</span><span style="color: #000000; ">		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">rxCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">18</span><span style="color: #000000; ">.</span><span style="color: #008000; ">8</span><span style="color: #000000; "> </span><span style="color: #000000; ">mA</span><span style="color: #000000; ">;
		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">decodingCurrentDelta</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">mA</span><span style="color: #000000; ">;
		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">txCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">17</span><span style="color: #000000; ">.</span><span style="color: #008000; ">4</span><span style="color: #000000; "> </span><span style="color: #000000; ">mA</span><span style="color: #000000; ">;
		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">setupRxCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">6391</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// 0.002109 W = (ESetupPower+ESetupXtal+ETxCalibrate)/TSetupTx
</span><span style="color: #000000; ">		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">setupTxCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">6845</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// 0.002259 W = (ESetupPower+ESetupXtal+ERxCalibrate)/TSetupRx
</span><span style="color: #000000; ">		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">rxTxCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">18</span><span style="color: #000000; ">.</span><span style="color: #008000; ">8</span><span style="color: #000000; "> </span><span style="color: #000000; ">mA</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// Upper bound
</span><span style="color: #000000; ">		</span><span style="color: #000080; font-weight: bold; ">double</span><span style="color: #000000; "> </span><span style="color: #000000; ">txRxCurrent</span><span style="color: #000000; "> </span><span style="color: #000000; font-weight: bold; ">@unit</span><span style="color: #000000; ">(</span><span style="color: #000000; ">mA</span><span style="color: #000000; ">) = </span><span style="color: #008000; ">18</span><span style="color: #000000; ">.</span><span style="color: #008000; ">8</span><span style="color: #000000; "> </span><span style="color: #000000; ">mA</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// idem
</span><span style="color: #000000; ">		
    </span><span style="color: #800000; font-weight: bold; ">gates</span><span style="color: #000000; ">:
        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperGateIn</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// from upper layers
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">radioIn</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// to receive AirFrames
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">output</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperGateOut</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// to upper layers
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">output</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperControlOut</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// control connection
</span><span style="color: #000000; ">        </span><span style="color: #000080; font-weight: bold; ">input</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperControlIn</span><span style="color: #000000; ">;

    </span><span style="color: #800000; font-weight: bold; ">submodules</span><span style="color: #000000; ">:
        </span><span style="color: #000000; ">phy</span><span style="color: #000000; ">: </span><span style="color: #000000; ">PhyLayerBattery</span><span style="color: #000000; "> {
            </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
                </span><span style="color: #000000; ">decider</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">xmldoc</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;Nic802154_TI_CC2420_Decider.xml&quot;</span><span style="color: #000000; ">);
                </span><span style="color: #808080; font-style: italic; ">//publishRSSIAlways = false;
</span><span style="color: #000000; ">                </span><span style="color: #000000; ">headerLength</span><span style="color: #000000; "> = </span><span style="color: #008000; ">48</span><span style="color: #000000; "> </span><span style="color: #000000; ">bit</span><span style="color: #000000; ">; </span><span style="color: #808080; font-style: italic; ">// ieee 802.15.4                
</span><span style="color: #000000; ">                </span><span style="color: #000000; ">thermalNoise</span><span style="color: #000000; "> = -</span><span style="color: #008000; ">110</span><span style="color: #000000; "> </span><span style="color: #000000; ">dBm</span><span style="color: #000000; ">;
                </span><span style="color: #808080; font-style: italic; ">// From TI CC1100 datasheet rev. C
</span><span style="color: #000000; ">                </span><span style="color: #000000; ">timeSleepToRX</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">001792</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">timeSleepToTX</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">001792</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">timeRXToTX</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">000192</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">timeTXToRX</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">000192</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">timeRXToSleep</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">timeTXToSleep</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #808080; font-style: italic; ">// power consumption from boards
//                sleepPower = 0.0000000693 W; // 0.021 microA * 3.3 V
//                rxPower = 0.06204 W;   // 18.8 mA * 3.3 V
//                txPower = 0.05742 W;   // 17.4 mA * 3.3 V
//                rxTxPower = 0.06204 W; // Upper bound : 18.8 mA * 3.3 V
//                txRxPower = 0.06204 W; // idem
//                setupTxPower = 0.002109 W; // (ESetupPower+ESetupXtal+ETxCalibrate)/TSetupTx
//                setupRxPower = 0.002259 W; // (ESetupPower+ESetupXtal+ERxCalibrate)/TSetupRx
</span><span style="color: #000000; ">                </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;p=96,236;i=block/wrxtx&quot;</span><span style="color: #000000; ">);

        }
        </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">: </span><span style="color: #000000; ">CSMA802154</span><span style="color: #000000; "> {
            </span><span style="color: #800000; font-weight: bold; ">parameters</span><span style="color: #000000; ">:
                </span><span style="color: #000000; ">rxSetupTime</span><span style="color: #000000; "> = </span><span style="color: #008000; ">0</span><span style="color: #000000; ">.</span><span style="color: #008000; ">001792</span><span style="color: #000000; "> </span><span style="color: #000000; ">s</span><span style="color: #000000; ">;
                </span><span style="color: #000000; ">txPower</span><span style="color: #000000; "> = </span><span style="color: #800000; font-weight: bold; ">default</span><span style="color: #000000; ">(</span><span style="color: #008000; ">1</span><span style="color: #000000; "> </span><span style="color: #000000; ">mW</span><span style="color: #000000; ">);
				
                </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;p=96,87;i=block/layer&quot;</span><span style="color: #000000; ">);

        }
    </span><span style="color: #800000; font-weight: bold; ">connections</span><span style="color: #000000; ">:

        </span><span style="color: #000000; ">radioIn</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">--&gt;</span><span style="color: #000000; "> </span><span style="color: #000000; ">phy</span><span style="color: #000000; ">.</span><span style="color: #000000; ">radioIn</span><span style="color: #000000; ">;

        </span><span style="color: #000000; ">phy</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperGateIn</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">&lt;--</span><span style="color: #000000; "> { </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;m=m,25,0,25,0&quot;</span><span style="color: #000000; ">); } </span><span style="color: #800000; font-weight: bold; ">&lt;--</span><span style="color: #000000; "> </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">lowerGateOut</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">phy</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperGateOut</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">--&gt;</span><span style="color: #000000; "> { </span><span style="color: #000000; font-weight: bold; ">@display</span><span style="color: #000000; ">(</span><span style="color: #008000; ">&quot;m=m,73,0,50,50&quot;</span><span style="color: #000000; ">); } </span><span style="color: #800000; font-weight: bold; ">--&gt;</span><span style="color: #000000; "> </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">lowerGateIn</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">phy</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperControlOut</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">--&gt;</span><span style="color: #000000; "> </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">lowerControlIn</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">phy</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperControlIn</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">&lt;--</span><span style="color: #000000; "> </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">lowerControlOut</span><span style="color: #000000; ">;

        </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperGateOut</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">--&gt;</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperGateOut</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperControlOut</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">--&gt;</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperControlOut</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperGateIn</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">&lt;--</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperGateIn</span><span style="color: #000000; ">;
        </span><span style="color: #000000; ">mac</span><span style="color: #000000; ">.</span><span style="color: #000000; ">upperControlIn</span><span style="color: #000000; "> </span><span style="color: #800000; font-weight: bold; ">&lt;--</span><span style="color: #000000; "> </span><span style="color: #000000; ">upperControlIn</span><span style="color: #000000; ">;

}

</span></pre>
   <hr><p class="footer"><a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top"><img src="by-sa.png"></a> This documentation is released under the <a href="http://creativecommons.org/licenses/by-sa/3.0" target="_top">Creative Commons license</a></p>
   </body>
</html>
